package com.yuyang.wifi.utils;

import android.content.Context;
import android.net.Uri;
import android.os.Build;

import java.io.File;

import androidx.core.content.FileProvider;

public class DCommManager {

    public static int getStateBarHeight(Context a) {
        int result = 0;
        int resourceId = a.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result = a.getResources().getDimensionPixelSize(resourceId);
        }
        return result;
    }

    public static Uri makeUri(Context context, File file) {
        Uri uri;
        if (Build.VERSION.SDK_INT >= 24) {//7.0
            uri = FileProvider.getUriForFile(context, context.getPackageName() + ".fileProvider", file);
        } else {
            uri = Uri.fromFile(file);// Uri.parse("file://" + apkfile.toString());
        }
        return uri;
    }
}
